package com.marveal.rabbit.common.util;

import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;

import java.util.Objects;

public class Assert {

    public static void notEmpty(@Nullable Object object, String message) {
        if (ObjectUtils.isEmpty(object)) {
            throw new NullPointerException(message);
        }
    }

    public static void notNull(@Nullable Object object, String message) {
        if (Objects.isNull(object)) {
            throw new NullPointerException(message);
        }
    }

    public static void notNull(@Nullable String string, String message) {
        if (Objects.isNull(string) || "".equals(string)) {
            throw new NullPointerException(message);
        }
    }
}
